//
//  matrix4x4.h
//  GLDemo
//
//  Created by wneqi on 14-6-6.
//  Copyright (c) 2014年 xiewneqi. All rights reserved.
//

#ifndef __GLDemo__matrix4x4__
#define __GLDemo__matrix4x4__

#include "common_header.h"
#include "vector4.h"
#include <iostream>

class Matrix4x4
{
public: // constructors and destructors
    Matrix4x4 ();
    
    Matrix4x4 (Vector4 row0, Vector4 row1, Vector4 row2, Vector4 row3);
    
    ~Matrix4x4 ();
    
public: // getters and setters
    Matrix4x4 GetInverse () const;
    
    Matrix4x4 GetTranspose () const;
    
    Matrix4x4 GetCofactorMatrix () const;
    
    Matrix4x4 GetAdjustMatrix () const;
    
    GLfloat GetDeterminant () const;
    
    GLfloat GetMinorDeterminant (int rowIndex, int colIndex) const;
    
    GLfloat GetCofactor (int rowIndex, int colIndex) const;
    
    bool IsIdentity () const;
    
    Vector4 GetColumn (int colIndex) const;
    
    Vector4 GetRow (int rowIndex) const;
    
    void SetColumn (int colIndex, Vector4 column);
    
    void SetRow (int rowIndex, Vector4 row);
    
public: // methods
    
public: // operators
    Vector4& operator[] (int rowIndex);
    
    const Vector4& operator[] (int rowIndex) const;
    
    Matrix4x4 operator * (const Matrix4x4& m) const;
    
    Matrix4x4 operator / (GLfloat s) const;
    
    Matrix4x4 operator + (const Matrix4x4& m) const;
    
    Matrix4x4 operator - (const Matrix4x4& m) const;
    
    bool operator == (const Matrix4x4& m) const;
    
    bool operator != (const Matrix4x4& m) const;
    
    friend std::ostream& operator << (std::ostream& stream, const Matrix4x4& m);
    
public: // static methods
    
public: // static members
    static const Matrix4x4 identity;
    
    static const Matrix4x4 zero;
    
public: // private members
    Vector4 m_rowVectors[4];
};


#endif /* defined(__GLDemo__matrix4x4__) */
